package config

import (
	captcha "github.com/mojocn/base64Captcha"
	"gopkg.in/yaml.v2"
	"io/ioutil"
	"log"
	"time"
)
var Version string = time.Now().Format("2006-01-02 15:04:05")
var Store = captcha.DefaultMemStore
type Config struct {
	MysqlUrl string `yaml:"mysql_url"`
	Port  string `yaml:"port"`
}

func (c *Config) GetConfig() *Config {
	yamlFile, err := ioutil.ReadFile("./config/config.yaml")
	if err != nil {
		log.Printf("yamlFile.Get err   #%v ", err)
	}

	err = yaml.Unmarshal(yamlFile, c)
	if err != nil {
		log.Fatalf("Unmarshal: %v", err)
	}
	return c
}
